from django.db import models

# Create your models here.

'''
    Attendance:考勤表
        staffs:员工id
        startTime：上班时间
        endTime：下班时间
        isError：是否异常
'''
class Attendance(models.Model):
    staffs = models.ForeignKey(Staff, on_delete=models.CASCADE)
    startTime = models.DateTimeField(auto_now=True)
    endTime = models.DateTimeField()
    isError = models.BooleanField()
    class Meta():
        db_table = 'Attendance'


'''
    ClassApply:申请分类表
        className：申请分类名
'''
class ClassApply(models.Model):
    className = models.CharField(max_length=20)
    class Meta():
        db_table = 'ClassApply'

'''
    Application:申请表
        classapplys ：申请分类id
        staffs:员工id
        startTime：开始时间
        endTime：结束时间
        applyContent:申请事由
'''
class Application(models.Model):
    classapplys = models.ForeignKey(to='ClassApply', on_delete=models.CASCADE)
    staffs = models.ForeignKey(Staff, on_delete=models.CASCADE)
    startTime = models.DateTimeField()
    endTime = models.DateTimeField()
    applyContent = models.CharField(max_length=200)
    class Meta():
        db_table = 'Application'

'''
    Verification:审核表
        verTime：审核时间
        staffs：员工id 用户保存审核人的信息
        applications:申请id
        verStatus：审核状态
'''
class Verification(models.Model):
        verTime = models.DateTimeField(auto_now=True)
        staffs = models.ForeignKey(Staff, on_delete=models.CASCADE)
        applications = models.ForeignKey(Application, on_delete=models.CASCADE)
        verStatus = models.IntegerField()
        class Meta():
            db_table = 'Verification'









